<!DOCTYPE html>
<html xmlns='http://www.w3.org/1999/xhtml' xml:lang='vi-vn' lang='vi-vn'>
<head>
	<title><?php echo $title  ?> - <?php echo PRODUCT ?> <?php echo VERSION ?></title>
	<base href="<?php echo base_url() ?>" />
	<meta http-equiv="content-type" content="text/html; charset=UTF-8" />
	<meta name="robots" content="noindex, nofollow" />
	<meta name="viewport" content="width=device-width, initial-scale=1, maximum-scale=1" />
	<link rel="shortcut icon" href="img/icon.png" />
	<link rel="stylesheet" href="css/style.css" />
	<link rel="stylesheet" href="css/themes.css" />
	<link rel="stylesheet" href="css/responsive.css" />
	<style media="screen">
	.noPrint{ display: ; }
	.yesPrint{ display: none !important; }
	</style>
	<style media="print">
	.noPrint{ display: none !important; }
	.yesPrint{ display: ; }
	</style>
	<script>
	var site_url = '<?php echo site_url() ?>';
	</script>
	<script src="js/jquery-2.0.3.min.js"></script>
	<script src="js/bootstrap.min.js"></script>
</head>
<body class="<?php echo $GLOBALS['var']['body_skin'] ?>">
	<a id="btn-scrollup" class="btn" href="#"><i class="fa fa-chevron-up"></i></a>
	<div class="opaDiv"></div>
	<div class="notiLoading">Đang tải...</div>
	<div id="updateMes"></div>
	<div class="commandDiv noPrint">
	    <div style="padding-top: 13px;"><span class="selectedItem">0</span> mục đã chọn</div>
	    <?php
	    echo '<div id="cmdBtnDelRestore" class="btn btn-'.($uri['deleted'] ? 'success' : 'danger').'"><span class="icon glyphicons white '.($uri['deleted'] ? 'refresh' : 'bin').'"></span><div class="hide640">'.($uri['deleted'] ? 'Khôi phục' : 'Xóa').'</div></div>';
	    echo '<div id="cmdBtnRemove" class="btn btn-danger"><span class="icon glyphicons white remove_2"></span><div class="hide640">Xóa vĩnh viễn</div></div>';
	    ?>
	</div>
	<input type="hidden" id="act" value="<?php echo $act ?>" />
	<input type="hidden" id="do" value="<?php echo $do ?>" />
	<input type="hidden" id="id" value="<?php echo $id ?>" />
	<input type="hidden" id="rowstart" value="<?php echo $GLOBALS['var']['rowstart'] ?>" />
	<input type="hidden" id="deleted" value="<?php echo $uri['deleted'] ?>" />
	<input type="hidden" id="jsonSort" />
	<div id="navbar" class="navbar navbar-fixed">
		<button type="button" class="navbar-toggle navbar-btn collapsed"><span class="fa fa-bars"></span></button>
		<a class="navbar-brand" href="./"><small><i class="fa fa-desktop"></i> <span class="hide1200"><?php echo PRODUCT ?> <?php echo VERSION ?></span></small></a>
		<div id="skinsDiv" class="hide480">
	        <a href="javascript:;"><i class="icon glyphicons white beach_umbrella"></i></a>
	        <span class="skins-box">
		        <div class="btn btn-circle skin blue" data-skin="blue"></div>
		        <div class="btn btn-circle skin purple" data-skin="purple"></div>
		        <div class="btn btn-circle skin green" data-skin="green"></div>
		        <div class="btn btn-circle skin orange" data-skin="orange"></div>
		        <div class="btn btn-circle skin red" data-skin="red"></div>
		        <div class="btn btn-circle skin pink" data-skin="pink"></div>
		        <div class="btn btn-circle skin yellow" data-skin="yellow"></div>
		        <div class="btn btn-circle skin black" data-skin="black"></div>
	        </span>
	    </div>
	    <div class="navbar-module" style="min-width: 200px;">
	    	<?php
	    	echo '<span class="module-title">'.$title.'</span>';
	        if ($add_link && $GLOBALS['per']['add'])
	        {
	            echo '<a href="'.$add_link.'" title="Thêm mới"><i class="icon glyphicons white circle_plus"></i></a>';
	        }
	        if ($act && !$do && check_module_do($act, 'del'))
	        {
	            if ($uri['deleted'])
	            {
	                echo '<a class="loading" title="Xem tất cả" href="'.site_url($act).'"><i class="icon glyphicons white undo"></i></a>';
	            }
	            else
	            {
	                echo '<a class="loading" title="Xem đã xóa" href="'.site_url($act).'?deleted=1"><i class="icon glyphicons white bin"></i></a>';
	            }
	        }
	    	?>
	    </div>
		<ul class="nav hiti-nav pull-right">
			<li class="user-profile">
				<a data-toggle="dropdown" href="#" class="user-menu dropdown-toggle">
					<img class="nav-user-photo hide480" src="img/avatar/thumbs/<?php echo ($GLOBALS['user']['icon'] && goodfile('img/avatar/thumbs/'.$GLOBALS['user']['icon']) ? $GLOBALS['user']['icon'] : 'no-avatar.png') ?>" alt="<?php echo $GLOBALS['user']['username'] ?>'s Photo" />
					<span class="hide768" id="user_info"><?php echo $GLOBALS['user']['username'] ?></span>
					<i class="fa fa-caret-down" style="margin-top: 10px !important;"></i>
				</a>
				<ul class="dropdown-menu dropdown-navbar" id="user_menu">
					<li class="nav-header"><i class="fa fa-clock-o"></i>Đăng nhập lúc <?php echo strftime('%H:%M', strtotime($GLOBALS['user']['last_login'])) ?></li>
					<li><a href="../" target="_blank"><i class="fa fa-cog"></i>Xem trang chủ</a></li>
					<li><a href="<?php echo site_url('profile') ?>"><i class="fa fa-user"></i>Thông tin cá nhân</a></li>
					<li><a href="#"><i class="fa fa-question"></i>Trợ giúp</a></li>
					<li class="divider"></li>
					<li><a href="#" id="logoutLnk"><i class="fa fa-sign-out"></i>Đăng xuất</a></li>
				</ul>
			</li>
		</ul>
		<?php
		if ($datetime_picker)
        {
            echo form_open($act.($do ? '/'.$do : ''), array('method' => 'get', 'class' => 'frmSearch', 'id' => 'updateFrm'));
            echo '<div class="datetime_picker hide640">';
            echo '<div class="datetime_form">';
            echo '<i class="icon glyphicons nameplate"></i>';
            echo '<input type="text" value="'.$uri['from'].'" class="input-search" name="from" id="from" title="từ ngày" autocomplete="off" />';
            echo '</div>';
            echo '<div class="datetime_to">';
            echo '<i class="icon glyphicons nameplate"></i>';
            echo '<input type="text" value="'.$uri['to'].'" class="input-search" name="to" id="to" title="đến ngày" autocomplete="off" />';
            echo '</div>';
            echo '<button id="submitBtn" class="btn btn-success"><span class="icon glyphicons white log_book"></span></button>';
            if ($uri['from'] || $uri['to'])
            {
            	echo '<button id="cancelDateSearchBtn" class="btn btn-danger" style="margin-right: 0px;" onclick="window.location = \''.site_url($act).($do ? '/'.$do : '').url_uri($uri, array('to', 'from', 'user')).'\'; return false;"><span class="icon glyphicons white remove_2"></span></button>';
            }
            echo '</div>';
            echo form_close();
        }
        if (!empty($date_picker))
        {
            echo form_open($act.($do ? '/'.$do : ''), array('method' => 'get', 'class' => 'frmSearch', 'id' => 'updateFrm'));
            echo '<div class="datetime_picker hide640">';
            echo '<div class="datetime_form">';
            echo '<i class="icon glyphicons nameplate"></i>';
            echo '<input type="text" value="'.$uri['date_added'].'" class="input-search date" name="date_added" autocomplete="off" style="width: 55px;" />';
            echo '</div>';
            echo '<button id="submitBtn" class="btn btn-success"><span class="icon glyphicons white log_book"></span></button>';
            if ($this->input->get('date_added', true))
            {
            	echo '<button id="cancelDateSearchBtn" class="btn btn-danger" style="margin-right: 0px;" onclick="window.location = \''.site_url($act).($do ? '/'.$do : '').url_uri($uri, array('date_added')).'\'; return false;"><span class="icon glyphicons white remove_2"></span></button>';
            }
            echo '</div>';
            echo form_close();
        }
        if ($search)
        {
            echo form_open(($act == 'online' ? $act.'/'.$do : $act), array('method' => 'get', 'class' => 'frmSearch'));
            echo '<div class="search-div">';
            echo '<i class="icon glyphicons search"></i>';
            echo form_input(array('name' => 'q', 'class' => 'input-search', 'value' => $uri['q']));
            if($uri['deleted'])
            {
            	echo form_input(array('type' => 'hidden', 'name' => 'deleted', 'value' => $uri['deleted']));
            }
            if($uri['q'] != '')
            {
            	echo '<a href="'.site_url(($act == 'online' ? $act.'/'.$do : $act)).url_uri($uri, array('q', 'user')).'"><i class="icon glyphicons remove"></i></a>';
            }
            echo '</div>';
            echo form_close();
        }
        else if($do == 'update' || $do == 'permiss' || $submit_btn || (!empty($back_btn) && is_array($back_btn)))
        {
            if ($act == 'update_products')
            {
            	$data_back = site_url('products');
            }
            else if ($act == 'update_articles')
            {
            	$data_back = site_url('articles');
            }
            else if ($act == 'newsletter' && $do == 'select_product')
            {
            	$data_back = site_url('newsletter/compose');
            }
            else
            {
            	$url_back = $this->input->get('data_back', true);
            	if ($this->input->get('data_back', true))
            	{
            		$data_back = $url_back;
            	}
            	else
            	{
            		$data_back = site_url($act).url_uri($uri);
            	}
            }
            if (strlen($submit_btn) == 1 && $submit_btn == true)
            {
            	$submit_btn = ($id ? 'Cập nhập' : 'Thêm mới');
            }
            echo '<div class="btnFrm">';
            if($do != 'view' && $submit_btn)
            {
            	echo '<button id="submitBtn" class="btn btn-success"><i class="icon glyphicons white ok_2"></i><span class="hide640">'.$submit_btn.'</span></button>';
            }
            if($act != 'profile' && ($act != 'timesheets' || $do != '') && empty($back_btn))
            {
            	echo '<button id="backBtn" class="btn btn-danger" data-back="'.$data_back.'"><i class="icon glyphicons white '.($id ? 'chevron-left' : 'remove_2').'"></i><span class="hide640">'.($id ? 'Trở lại' : 'Hủy bỏ').'</span></button>';
            }
            if((!empty($back_btn) && is_array($back_btn)))
            {
            	echo '<button id="backBtn" class="btn btn-danger" data-back="'.$back_btn[0].'"><i class="icon glyphicons white chevron-left"></i><span class="hide640">'.$back_btn[1].'</span></button>';
            }
            echo '</div>';
        }
        if (is_array($cat_list) && count($cat_list))
        {
            echo '<div class="filter_cat hide640"><div class="caption">Danh mục</div><i class="icon16 glyphicons white '.($filter_cat ? 'disk_saved' : 'align_left').'"></i><div class="filter_cat_list"><ul class="cat_treeview filetree treeview" data-height="280">'.cat_tree($cat_list, 0, $filter_cat, 'radio', true).'</ul></div></div>';
        }
        echo '<span class="'.($act == 'online' ? 'hide1200' : 'hide980').'">'.$page_list.'</span>';
		?>
	</div>
	<div id="prints" class="yesPrint"></div>
	<div class="container" id="main-container">
		<div id="sidebar" class="navbar-collapse collapse expansion sidebar-fixed<?php echo ($GLOBALS['var']['sidebar_collapsed'] ? ' sidebar-collapsed' : '') ?>">
			<ul class="nav nav-list" style="padding-bottom: 10px;">
				<?php echo admin_menu() ?>
			</ul>
			<div id="sidebar-collapse" class="visible-lg"><i class="fa fa-angle-double-left"></i></div>
			<div style="height: 40px; display: block">&nbsp;</div>
		</div>
		<div id="main-content">
			<table width="100%">
	    		<tr>
		            <td>
		                <div id="contentRight">